package com.ynny.practice10.service;

import com.ynny.practice10.dao.UserDao;
import com.ynny.practice10.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService{

@Autowired
UserDao userDao;
    @Override
    public int register(User user) {

        User repeatUser =userDao.selectUserName(user.getUsername());

        if(repeatUser == null){

            return 205;
        }

        int i= userDao.insertUser(user);
        if (i != 1){

            return 502;
        }

        return 200;




    }
}
